package com.raising;

import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

/**
 * 继承AbstractTransactionalJUnit4SpringContextTests 可以实现事务回滚
 * 继承AbstractJUnit4SpringContextTests 没有事务回滚机制
 *
 * 如需事务回滚，则在方法上面引入注解 @Rollback 或者不写
 * 如不需要事务回滚，则在方法上面引入注解 @Rollback(false)
 *
 * 集成 cobertura 插件，可查看测试覆盖率
 * cobertura:clean  清理
 * cobertura:cobertura  运行
 * @author GaoYuan
 * @datetime 2017/12/1 下午3:19
 */
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations={"classpath:applicationContext.xml","classpath:mybatis-config.xml","classpath:spring-mvc.xml"})
public class JUnitServiceBase extends AbstractTransactionalJUnit4SpringContextTests {
    /**Log4j日志处理*/
    protected org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());
}